package com.avic.rong.userOrder.activity;

import android.app.Activity;
import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.avic.rong.BaseActivity;
import com.avic.rong.R;

import butterknife.BindView;

public class ShopPayActivity extends BaseActivity {


    @BindView(R.id.tv_pay_way)
    TextView tvPayWay;
    @BindView(R.id.tv_address)
    TextView tvAddress;
    @BindView(R.id.tv_look_shou_address)
    TextView tvLookShouAddress;

    private String enterType;
    private String order_id;
    private String orderType;
    private String  order_sn;

    public static String ORDER_ID = "order_id";
    public static String ORDER_SN = "order_sn";
    private int COMMENT_FORCODE = 6;
    @Override
    protected int getContentViewId() {
        return R.layout.activity_bank_or_shop_pay;
    }

    @Override
    protected void initView() {
        if (getIntent().getIntExtra("orderType",-1)==-1) {
            if (!TextUtils.isEmpty(getIntent().getStringExtra("order_id"))||!TextUtils.isEmpty(getIntent().getStringExtra("order_sn"))){
                order_id = getIntent().getStringExtra("order_id");
                orderType = getIntent().getStringExtra("orderType");
                order_sn = getIntent().getStringExtra("order_sn");
            }else {
                finish();
            }

        }else {
            finish();

        }
        tvTitle.setText("到店支付");
    }

    @Override
    protected void addListener() {
        tvLookShouAddress.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(context, LookOrderAddressActivity.class);
                context.startActivity(intent);
            }
        });
        ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!orderType.equals("5")){
                    Intent intent = new Intent(context, OrderDetailsActivity.class);
                    intent.putExtra(ORDER_ID, order_id + "");

                    ((Activity) context).startActivityForResult(intent, COMMENT_FORCODE);
                }else {
                    Intent intent = new Intent(context, OrderDetailsPXActivity.class);
                    intent.putExtra(ORDER_SN, order_id + "");

                    ((Activity) context).startActivityForResult(intent, COMMENT_FORCODE);
                }
            }
        });
    }


}
